#include <QtGui>

#include "invader_bullet.h"
#include "media.h"

InvaderBullet::InvaderBullet (BulletType type, QWidget *parent)
  : QLabel (parent)
{
  _movie = new QMovie (this);
  _movie->setCacheMode (QMovie::CacheAll);

  switch (type) { 
    case BulletTypeOne:
      _movie->setFileName (MEDIA_DIR INVADER_BULLET1_GIF);
      break;

    case BulletTypeTwo:
      _movie->setFileName (MEDIA_DIR INVADER_BULLET2_GIF);
      break;
  }

  _movie->jumpToFrame (0);

  setMovie (_movie);

  setMouseTracking (true);
}

void InvaderBullet::advanceFrame ()
{
  _movie->jumpToNextFrame ();
}
